import { requestApi } from "@/utils/request";
import type { DetailsPageTypeResponse, DetailsPageRecommendResponse } from "@/types/details-page";

// 进入游记详情页：多表联查
export const getDetailsPageAPI = (article_id: string) => {
    return requestApi<DetailsPageTypeResponse>({
        url: '/article-data',
        method: 'GET',
        data: {
            article_id
        }
    })
}

// 进入游记详情页：短视频类型
export const getDetailsPageVideoAPI = (article_id: string,page:number) => {
    return requestApi<DetailsPageTypeResponse>({
        url: '/rec-the-video',
        method: 'GET',
        data: {
            article_id,
            page
        }
    })
}

// 进入游记详情页：推荐相关游记
export const getDetailsPageRecommendAPI = (article_id: string,page:number) => {
    return requestApi<DetailsPageRecommendResponse>({
        url: '/rec-the-same',
        method: 'GET',
        data: {
            article_id,
            page
        }
    })
}

// 取消关注
export const getDetailsPageCancelConcernAPI = (im_concerned_uid: string) => {
    return requestApi({
        url: '/unfollow-author',
        method: 'GET',
        data: {
            im_concerned_uid
        }
    })
}

// 关注
export const getDetailsPageFollowAPI = (im_concerned_uid: string) => {
    return requestApi({
        url: '/follow-author',
        method: 'GET',
        data: {
            im_concerned_uid
        }
    })
}

// 取消点赞
export const getDetailsPageCancelLikeAPI = (article_id: string) => {
    return requestApi({
        url: '/cancel-like',
        method: 'GET',
        data: {
            article_id
        }
    })
}

// 用户给游记点赞
export const getDetailsPageLikeAPI = (article_id: string) => {
    return requestApi({
        url: '/user-like',
        method: 'GET',
        data: {
            article_id
        }
    })
}

// 用户取消收藏
export const getDetailsPageCancelCollectionAPI = (article_id: string) => {
    return requestApi({
        url: '/cancel-collection',
        method: 'GET',
        data: {
            article_id
        }
    })
}

// 用户收藏游记
export const getDetailsPageCollectTravelAPI = (article_id: string) => {
    return requestApi({
        url: '/collect-travel',
        method: 'GET',
        data: {
            article_id
        }
    })
}